<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<link rel="icon" href="assets/favicon.ico" type="image/x-icon" />
	<meta content="1 days" name="revisit-after" />
	<meta content="telephone=no" name="format-detection" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, target-densitydpi=medium-dpi, user-scalable=0" />
	<meta content="black" name="apple-mobile-web-app-status-bar-style" />
	<meta content="false" id="twcClient" name="twcClient" />

	<title>售后服务体验调查问卷</title>
    <link rel="stylesheet" type="text/css" href="index.css?r=3" />
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?c556ddb026ed5d70e9ec59737fcc3cf9";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

    <script>
        var testNow=false;
        //授权相关变量
        var openid, openid_md5, nickname, sex, province, city, country, headimgurl;
        var appname = 'GhacWinterEvent';//当前项目唯一标识，用来区分不同项目的cookie
        var source='';

        init();
        function init() {
            GetCode();
            // alertMsg('测试版本');
            //delInfo();
            if (testNow) {
                openid = 'eee';
                openid_md5 = 'dbb1ac9273335ec258aa2ab77e50a972';
                nickname = '小明';
                sex = '1';
                province = '北京';
                city = '北京';
                country = 'CN';
                headimgurl = 'http://wx.qlogo.cn/mmopen/BA8GZZ2EGwVckE3zlfIdkibgctJ22eS2fWYoB4rzNvV4rpFSLPQtRkOdhGcKPLDdkOEqbcxk2WOq5ofmVHqEaIw/0';
                source='AAA';
            }else{
                iniLogin();
            }
        }


        function getParam(name) {
            return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || '';
        }
        //授权，根据来路显示相应的界面
        function iniLogin() {
            //alert(document.location.href);
            readInfo();
            if (openid != null) {
                //已经获得授权
            } else {
                //未授权
                //自动跳转到授权页面
                document.location.href = 'getopenid.php?gotourl=index.html&state=' + appname+'&source='+source;
            }
        }
        //读取本地存储的用户信息，跳转到对应的画面
        function readInfo() {
            openid = getCookie(appname + "_openid");
            openid_md5 = getCookie(appname + "_openid_md5");
            nickname = decodeURI(getCookie(appname + "_nickname"));
            sex = decodeURI(getCookie(appname + "_sex"));
            province = decodeURI(getCookie(appname + "_province"));
            city = decodeURI(getCookie(appname + "_city"));
            country = decodeURI(getCookie(appname + "_country"));
            headimgurl = decodeURIComponent(decodeURI(getCookie(appname + "_headimgurl")));
            if (String(headimgurl).indexOf('http') >= 0) {
                //shareImg=headimgurl;
            }
            //alert('openid='+openid+'\nopenid_md5='+openid_md5+'\nnickname='+nickname+'\nsex='+sex+'\nprovince='+province+'\ncity='+city+'\ncountry='+country+'\nheadimgurl='+headimgurl);
        }
        //删除cookie
        function delInfo() {
            delCookie(appname + "_openid");
            delCookie(appname + "_openid_md5");
            delCookie(appname + "_nickname");
            delCookie(appname + "_sex");
            delCookie(appname + "_province");
            delCookie(appname + "_city");
            delCookie(appname + "_country");
            delCookie(appname + "_headimgurl");
            alert('cookies清除成功');
        }
        //读取地址栏参数，存入变量中
        function GetCode(){
            if(getParam('code') || GetHashString('source')){
                if (getParam('code')) {
                    source=getParam('code');
                }
                if (GetHashString('source')) {
                    source=GetHashString('source');
                    location.href = 'index.html?code='+source;//清空分享的图片地址1
                }
            }
        }
        function setCookie(name,value)
        {
            var Days = 30;
            var exp = new Date();
            exp.setTime(exp.getTime() + Days*24*60*60*1000);
            document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
        }
        //读取cookies
        function getCookie(name)
        {
            var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
            if(arr=document.cookie.match(reg)) return unescape(arr[2]);
            else return null;
        }
        //删除cookies
        function delCookie(name)
        {
            var exp = new Date();
            exp.setTime(exp.getTime() - 1);
            var cval=getCookie(name);
            if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
        }
        //获取地址栏hash
        function GetHashString(name)
        {
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.hash.substr(1).match(reg);
            if(r!=null)return  unescape(r[2]); return null;
        }
        //显示提示文本
        function alertMsg(msg){
            getEl('msg').innerHTML=msg;
            addClass(getEl('tips'), 'show');
        }
        function closeMsg(){
            removeClass(getEl('tips'), 'show');
        }
        //添加样式
        function addClass(elm,newClass){
            var classes = elm.className.split(' ');
            var classIndex=hasClass(elm,newClass);
            if(classIndex==-1){
                classes.push(newClass);
            };
            elm.className = classes.join(' ');
        }

        function hasClass(elm,className){
            var classes = elm.className.split(' ');
            for(var a in classes){
                if(classes[a]==className){
                    return a;
                };
            }
            return -1;
        }
        function removeClass(elm,className){
            var classes = elm.className.split(' ');
            var classIndex=hasClass(elm,className);
            if(classIndex!=-1){
                classes.splice(classIndex,1);
            };
            elm.className=classes.join(' ');
        }
        //获取dom
        function getEl(id) {
            return document.getElementById(id);
        }

        function initPage(){
            iniWx();
            iniUiScale();
            if(source==''){
                getEl('infoForm').style.display='block';
            }
        }

        //生成分享地址
        function submitForm(frm){
            for(var i=0,len = frm.elements.length; i < len; i++) {
                el = frm.elements[i];
                if(el.name=='shop_code' && el.value=='') {
                    alertMsg('请填写正确的特约店编码!');
                    return false;
                }
            }
            location.href='index.html?code='+getEl('shop_code').value;
        }
        //控制ui自适应
        function iniUiScale() {
            var p = document.documentElement.clientWidth / 640;
            getEl('infoForm').style.zoom = p;
        }
    </script>
    <style>
        /*tips*/
        .tips{
            position: fixed;
            top:0;
            left:0;
            z-index: 999;
            width:100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            display: none;
        }
        .show{
            display: block;
        }
        .tips .con{
            position: absolute;
            left:10%;
            top: 40%;
            width:80%;
            height: auto;
            border-radius: 20px;
            background: #141e54;
            color: #fff;
            text-align: center;
        }
        .tips .con .msg{
            padding: 30px 20px;
            font-size: 14px;
        }
        .tips .con .btn{

        }
        .tips .con .btn a{
            position: absolute;
            right:0px;
            top:0px;
            display: block;
            padding: 10px 20px;
            font-size: 16px;
            text-decoration:none;
            color: #3e71a7;

        }

        /*inforForm*/
        .infoForm {
            position: fixed;
            left: 0;
            bottom: 0;
            z-index: 4;
            width: 640px;
            height: 100%;
            text-align: center;
            color: #333;
            display: none;
            background: #eee;
            background-size: cover;
        }
        .infoForm .infoFormBd{
            width:488px;
            height: 100%;
            margin: 0 auto;
            margin-top: 30%;
        }
        .infoForm form {
            width: 100%;
            margin: 0 auto;
        }

        .infoForm input {
            display: block;
            width: 100%;
            height: 80px;
            line-height: 80px;
            background: #fff;
            color: #333;
            font-size: 150%;
            text-indent: 20px;
            border: none;
            border-radius: 5px;
            margin: 1px auto 0 auto;
        }
        .infoForm .shopName{
            width: 100%;
            height: 80px;
            line-height: 80px;
            background: #fff;
            border-radius: 5px;
            margin: 1px auto 0 auto;
            font-size: 150%;
        }
        .infoForm .shopName input{
            width: 60%;
            display: inline-block;
            border-radius: 0px;
            margin: 0px;
            font-size: 100%;
        }
        .infoForm form a.btn {
            display: block;
            width:100%;
            height: 70px;
            line-height: 70px;
            margin: 0 auto;
            margin-top: 40px;
            text-decoration: none;
            color: #fff;
            background: #f08700;
            border-radius: 5px;
            -webkit-tap-highlight-color: transparent;
            font-size: 150%;
        }
        .infoForm .logo{
            position: absolute;
            left:20px;
            top:20px;
        }
    </style>
	<script>
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "https://hm.baidu.com/hm.js?c556ddb026ed5d70e9ec59737fcc3cf9";
	  var s = document.getElementsByTagName("script")[0];
	  s.parentNode.insertBefore(hm, s);
	})();
	</script>
</head>
<body onload="initPage();">
<div class="page-home">
    <img src="images/title.png" />
    <strong></strong>
    <p>您已参加调查！</p>
	<h5>务必车主本人填写!</h5>
</div>

<div class="page-login">
    <h3>
        请输入您的信息并开始填写问卷
    </h3>
    <form id="form_bind">
        <label><span><em>*</em>手机号</span><input type="tel" name="customer_phone" id="customer_phone" data-validate="phone" data-errmsg="请填写正确的手机号"/></label>
        <label><input class="code" type="number" name="code" data-validate="smscode" data-errmsg="请填写4位验证码"/><i id="btnCode">获取验证码</i></label>
        <label><span><em>*</em>车牌号</span><input type="text" name="customer_car_number" data-validate="car" data-errmsg="输入的车牌号格式不正确,例如 粤J12350"/></label>
        <p>*为必填项</p>
        <strong></strong>
    </form>
</div>

<div class="page-survey">
    <h3>售后服务体验调查问卷</h3>
    <h5>(最近一次的维修保养经历)</h5>
    <div>
        请根据您最近的保养/维修经历，用1到10分的评分标准给经销商的表现打分，1分表示无法接受, 4分表示一般，7分表示非常好，10分表示超乎想象的体验， 您可以选择1到10分的任一分值进行打分。
        <img src="images/score.png" />
    </div>
	<form id="survey_form"></form>
	<strong></strong>
</div>

<!-- 提示 -->
<div class="tips" id="tips" onclick="closeMsg();">
    <div class="con" ontouchstart="return false;">
        <div class="msg" id="msg">请选择答案</div>
        <div class="btn"><a href="javascript:void(0);" ontouchstart="closeMsg();">x</a></div>
    </div>
</div>

<!-- 提交表单-->
<div class="infoForm" id="infoForm">
    <div class="logo"><img src="images/logo1.png"/></div>
    <div class="infoFormBd">
        <p style="font-size: 200%; margin-bottom: 30px;">特约店信息填写</p>
        <form method="POST" id="js_frm_submit2">
            <input id="shop_code" type="text" name="shop_code" placeholder="请输入特约店编码" onblur="window.scrollTo(0,0);"/>
            <p style="margin-top:20px;">
                <a class="btn" href="javascript:void(0);" onclick="submitForm(getEl('js_frm_submit2'));">生成调查问卷H5</a>
            </p>
        </form>
    </div>
</div>

<script src="index.js?r=13"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="http://ghac.twomi.cn/accessToken/signPackage.php"></script>
<script src="wxshare.js?r=3"></script>
</body>
</html>
